The invention relates generally to image processing and more specifically to selecting colors for pixels in blocks for use in a block truncation coding image compression technique.
Data reduction is required in data handling processes, where too much data is present for practical applications that use it. Digital images images that have been discretized in both spatial coordinates and in brightness levels such as those acquired by scanningxe2x80x94are often very large, and thus make desirable candidates for at least one form of data reduction. This is true not only to allow for data to be processed at faster speeds, thereby causing less inconvenience to the user, but to enable more complex data to be processed without drastically increasing the image processing time. For example the number of bits required to accurately describe a detailed halftoned image will be many times more than that of a simple sheet of black text on a white page. By the same token, accurately describing a color image will require an even larger volume of data than its greatly detailed halftoned counterpart. If some form of data reduction does not take place, processing of documents that contain halftone and color images can take an unacceptably long period of time.
Digital color images may be described in terms of the chrominance and luminance values for each pixel contained therein. It is obviously desired to reproduce color images such that the colors in the copy exactly, or at least closely match the corresponding colors in the original image. Since image input and output devices are often quite different, reproducing an accurate color image often requires some form of estimation between color spaces or color correction to be applied to the chrominance and luminance data before it is output.
Block Truncation Coding (BTC) is an image processing technique for encoding and decoding digital image data. BTC typically includes dividing an image into a matrix of blocks, and then sub-dividing each block into a matrix of picture elements or xe2x80x9cpixels.xe2x80x9d A pixel map is one in which each discrete location on the page contains a pixel that emits a light signal with a value that indicates the color or, in the case of gray scale documents, how light or dark the image is at that location. As those skilled in the art will appreciate, most pixel maps have values that are taken from a set of discrete, non-negative integers.
Color images are typically described as being divided into xe2x80x9cseparations.xe2x80x9d Color output devices such as printers and computer monitors typically output data using only a few independent color sources. Colorants or color signals obtained from these sources are then blended together in appropriate ways in order to produce the full gamut of colors that may be represented using the device. In a device dependent printer color space, Cyan, Magenta, Yellow and black are the individual colorants that are most often used in color printers. These colorant separations are typically labeled C, M, Y and K. Many device-independent color spaces also exist, such as CIE L*a*b*, in which the separations are Lightness, labeled L*, relative amount of red vs. green, labeled a*, and relative amount of yellow vs. blue, labeled b*.
In a pixel map for a color document, individual separations are often represented as digital values, often in the range 0 to 255, where 0 represents no colorant (i.e. when CMYK separations are used), or the lowest value in the range when luminance-chrominance separations are used. In an L*a*b* luminance-chrominance color space a 0 L* value means that no light is present (i.e. the location is completely black), while a*=0 means no red or green is present and b*=0 means that the spot is neither blue nor yellow. Both a*=0 and b*=0 means that the spot is gray, (somewhere between black and white). When represented in an integer space, L*, a*, and b* are typically scaled and translated to fit the range of representable values. In this case a*=b*=0 is actually represented with these values at the midpoint of their ranges, while a*=0 is used to represent green, and b*=0 is used to represent blue.
Consequently 255 represents the maximum amount of colorant (for CMYK) or the highest value in the range (maximum light/white, red and yellow respectively for L*a*b*). In a gray-scale pixel map this typically translates to pixel values which range from 0, for black, to 255, for the whitest tone possible. The pixel maps of concern in the currently preferred embodiment of the present invention are representations of xe2x80x9cscannedxe2x80x9d images. That is, images which are created by digitizing light reflected off of physical media using a digital scanner. The term bitmap is used to mean a binary pixel map in which pixels can take one of two values, 1 or 0.
Once the block has been divided into pixels, the image is encoded, stored or transmitted to another location, and then decoded upon retrieval or receipt for subsequent processing. A primary goal of a BTC technique is to minimize the number of bits required to encode each pixel while retaining as much quality and detail in the output image that can be generated from the decoded data.
BTC techniques typically require storing several different colors in a color map, with each color being stored at a different address in memory. Two colors are then selected for each block in the image, and a bit map is generated for the block to indicate which color is assigned to each pixel. Binary numbers that represent the addresses of the color designated for each pixel are read from the color map memory location in response to the bitmap value for that pixel. In other words, every pixel in a given block must have one of the two colors that have been designated for that particular block. Consequently, the color of each pixel can be represented by only a single data bitxe2x80x94either a xe2x80x9c1xe2x80x9d or a xe2x80x9c0xe2x80x9dxe2x80x94in combination with two binary numbers per block which represent the color map memory addresses for the two colors selected for each block. The information obtained from the color map memory is used to generate an output image made up of pixels that have the selected colors as specified by that data.
By confining the choice of colors to a preselected group of colors, a BTC system can enable a large amount of image information to be represented by a relatively small number of bits, thereby permitting relatively complex images to be displayed in great detail, and animated, from a relatively small amount of encoded data. More specifically, the information needed to accurately display of any one of the preselected colors is stored in the color map memory. Thus the only information required to be encoded is the memory address for the desired color for the various pixel locations.
As indicated earlier, all pixels in each block must be represented by one of only two colors that have been assigned to the block. If the two colors that are selected to represent each block are not selected carefully, the colors in the final decoded output image will not accurately represent those in the original image. The present invention discloses a method and apparatus for selecting the colors that will be assigned to a two color block and subsequently assigning colors to the pixels in the block in order to accurately reproduce a color image.
Known methods of selecting colors for the block attempt to find the two extreme colors in a single pass. The extreme colors obtained from this pass are the two colors that will be assigned to the block. Each pixel in the block is then assigned to the color that is closest to the actual color of that pixel. This scheme is acceptable for the most common scenario, the case in which a block contains two colors and a clear boundary between them. Intermediate colors appear along the boundary and properly, they are not used to find the colors that will be selected to represent the block since the extreme colors will give the most realistic appearance. But problems arise when there are more than two primary clusters of pixels that have essentially the same color. Blocks with more than two clusters are likely to occur in regions of the image that contain high frequency texture data or noise. When this is the case, the color chosen for the second color selected for the block will represent noise, rather than an important color in the area. Assigning a noise color to the block will cause more pixels to take on that color in the encoded, and thus decoded image, thereby amplifying the noise.
Various techniques for processing images have hereinbefore been devised as illustrated by the following disclosures, which may be relevant to certain aspects of the present invention:
U.S. Pat. No. 5,828,467 to Suzuki issued Oct. 27, 1998 discloses block noise prevention by selective interpolation of decoded image data. An image processor for improving the quality of a picture, in which block noise arises as a result of a block encoding operation, by rendering gradations between blocks contiguous is included. A control point determination section reads references pixels from a decoded image storage section in accordance with a block address output from a block address generating section. The control point determination section then outputs control point information. A boundary condition determination section determines vector information on the basis of the control point information. An interpolating section interpolates a pixel block using a bicubic interpolated surface, and the thus interpolated pixel block is held in a buffer. A control point comparison section determines whether the pixel block can be interpolated and outputs prohibition information. On the other hand, a pixel block output from an 8 by 8 pixel block reading section is held in another buffer. As a result, an in-block variance calculating section calculates variance and then outputs variance information. A buffer switch determination section selects either of the buffers depending on the prohibition information and the variance information, whereby a buffer switch is switched. The thus selected output is held in a reproduced image storage section.
U.S. Pat. No. 5,818,964 to Itoh issued Oct. 6, 1998 discloses a device and method for filtering out the noise generated due to coding of image data signals. The device has a threshold determining unit, a binary index unit, a filter selecting unit, and an adaptive filtering unit. The threshold determining unit 4 divides each pixel of the input image data into two gray levels. The binary indexes defined by the gray level are checked by a window with a prescribed size. If the region in the window is determined to be a homogeneous region, a heterogeneous region, or an impulse noise region (block 5), the filter selecting unit selects a filter corresponding to the determined region, and the image data is processed by the selected filter.
U.S. Pat. No. 5,805,303 to Imaizumi et al. discloses a method of image processing that includes the steps of allocating image data of a document into a plurality of blocks of a predetermined pixel matrix; determining a gradient range exponent and a mean value information for each of the blocks based on the image data contained in each of the blocks; encoding the image data of each pixel of each of the blocks into code data based on the mean value information and gradient range exponent for the respective block so that the code data defines each pixel with fewer gradation levels than the image data; determining whether or not a mutually adjoining block is related to a solid image of a same density relative to a block subject to the encoding process; and executing a run length encoding process for a batch of mean value information, gradient range exponent, and code data based on a run length of adjoining blocks discriminated as related to a solid image of the same density.
U.S. Pat. No. 5,682,249 to Harrington et al. issued Oct. 28, 1997 discloses a method of encoding an image at full resolution for storing in a reduced image buffer for subsequent decoding and printing by a marking device, the method including the steps of dividing the image into a plurality of blocks wherein each block is comprised of a plurality of pixels, the step of identifying a number of color regions present in each of the plurality of blocks, the step of selecting a predefined encoding process from a plurality of predefined encoding processes for each of the plurality of blocks according to the number of color regions present in each of the plurality of block, and, the step of storing the encoded plurality of blocks in the reduced image buffer for subsequent decoding and printing by the marking device.
U.S. Pat. No. 4,580,134 to Campbell et al. issued Apr. 1, 1986 discloses a method of generating a color video display which comprises the steps of dividing a color image to be displayed into a matrix of blocks, each block comprising a matrix of pixels; storing data identifying a multiplicity m of different colors, the data being stored in a color map memory having a unique address for the data identifying each different color; selecting different pairs of the m colors for different blocks of the color image to be displayed; generating a pixel data bit for each pixel in each of the different blocks, the value of each pixel data bit identifying one of the pair of colors selected for the block in which the corresponding pixel is located; generating different pairs of binary numbers representing the color map memory addresses of the different pairs of the m colors selected for different blocks; reading out of the color map memory the stored data representing the particular color selected for each pixel, in response to the data bit for that pixel and the corresponding one of said binary numbers representing the address of one of the colors selected for the block containing that pixel; and using the data read out of the color map memory to generate a video display comprised of pixels having the selected colors as identified by the data read out of the color map memory.
E. J. Delp and O. R. Mitchell xe2x80x9cImage Compression Using Block Truncation Codingxe2x80x9d IEEE Transactions in Communications, Vol. COM-27, No. 9, pp. 1335-1342 disclose image compression by block truncation coding, and compare this method with transform and other techniques. The BTC algorithm uses a two-level (one bit) nonparametric quantizer that adapts to local properties of the image. Large amounts of data storage are not required, and the computation time is small.
All of the above cited references are incorporated by reference for their teachings.
In accordance with the invention there is provided a method of selecting colors to be assigned to pixels in an image for subsequent decoding and printing by a marking device, the method including the steps of: dividing the image into a plurality of blocks wherein each block is comprised of a plurality of pixels; identifying a plurality of pixel clusters in a block, wherein a pixel cluster includes a plurality of pixels that have substantially the same color; selecting a largest pixel cluster that includes the largest number of pixels and designating the largest pixel cluster color for a first assignment to the block; and calculating an average color for pixels outside of the largest pixel cluster, and designating the average outside pixel color for a next assignment to the block.
In accordance with another embodiment of the invention there is provided a method of encoding an image at a first resolution for storing in an image buffer at a second resolution, comprising the steps of dividing the image into a plurality of blocks wherein each block is comprised of a plurality of pixels; identifying a number of pixel clusters present in each of the plurality of blocks, wherein a pixel cluster includes a plurality of pixels that have substantially the same color; selecting a largest pixel cluster for each block that includes the largest number of pixels in the block and designating the largest pixel cluster color for a first assignment to the block; calculating an average color for pixels in the block that reside outside of the largest pixel cluster, and designating the average outside pixel color for a next assignment to the block; and storing the plurality of blocks in the reduced image buffer for subsequent decoding and printing by the marking device.